import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
let store = new Vuex.Store({
    state: {
        //第一人视角
        partoneScore: 0,
        //钻孔
        partwoScore: 0,
        //剖面
        partthreeScore: 0,
        //剖切
        partfourScore: 0,
        //拔高系数
        partfiveScore: 0,
        //分层展示
        partsixScore: 0,
        //分类展示
        partsevenScore: 0,
        //岩性查询
        parteightScore: 0,
        //距离量算
        partnineScore: 0,

    },
    getters: {
        getScore(state) {//获取器离state很近
            return state.partoneScore + state.partwoScore + state.partthreeScore + state.partfourScore + state.partfiveScore + state.partsixScore + state.partsevenScore + state.parteightScore + state.partnineScore;
        },
        getFirstScore(state) {
            return state.partoneScore;
        },
        getSecondScore(state) {
            return state.partfiveScore + state.partsixScore + state.partsevenScore;
        },
        getThirdScore(state){
            return state.parteightScore + state.partnineScore;
        },
        getFourScore(state){
            return state.partwoScore + state.partthreeScore + state.partfourScore;
        }
    },
    mutations: {
        //第一人视角
        addoneScore(state, num) {
            state.partoneScore = num
        },
        //钻孔
        addtwoScore(state, num) {
            state.partwoScore = num
        },
        //剖面
        addthreeScore(state, num) {
            state.partthreeScore = num
        },
        //剖切
        addfourScore(state, num) {
            state.partfourScore = num
        },
        //拔高系数
        addfiveScore(state, num) {
            state.partfiveScore = num
        },
        //分层展示
        addsixScore(state, num) {
            state.partsixScore = num
        },
        //分类展示
        addsevenScore(state, num) {
            state.partsevenScore = num
        },
        //岩性查询
        addeightScore(state, num) {
            state.parteightScore = num
        },
        //距离量算
        addnineScore(state, num) {
            state.partnineScore = num
        }
    },
    actions: {
        addoneScoreByAction({ commit }, num) {
            commit('addoneScore', num)
        },
        addtwoScoreByAction({ commit }, num) {
            commit('addtwoScore', num)
        },
        addthreeScoreByAction({ commit }, num) {
            commit('addthreeScore', num)
        },
        addfourScoreByAction({ commit }, num) {
            commit('addfourScore', num)
        },
        addfiveScoreByAction({ commit }, num) {
            commit('addfiveScore', num)
        },
        addsixScoreByAction({ commit }, num) {
            commit('addsixScore', num)
        },
        addsevenScoreByAction({ commit }, num) {
            commit('addsevenScore', num)
        },
        addeightScoreByAction({ commit }, num) {
            commit('addeightScore', num)
        },
        addnineScoreByAction({ commit }, num) {
            commit('addnineScore', num)
        }
    }
})
export default store;

